/*
 * Copyright 2016-2016 the original author or authors.
 * Created on 2016/12/26 下午8:48
 */
package cn.com.geasy.base.repoisitory;

import org.springframework.data.jpa.repository.support.SimpleJpaRepository;

import javax.persistence.EntityManager;
import java.io.Serializable;

/**
 * 该类仅用于实现 {@link BaseRepositoryCustom } 接口。
 *
 * @author Mechanic
 * @version 1.0
 */
public class BaseRepositoryImpl<T, ID extends Serializable>
  extends SimpleJpaRepository<T, ID>
  implements BaseRepositoryCustom<T, ID> {

    private EntityManager em;
    private Class<T> entityClass;

    public BaseRepositoryImpl(Class<T> domainClass, EntityManager em) {
        super(domainClass, em);
        this.em = em;
        this.entityClass = domainClass;
    }

    //@Transactional
    //@Override
    //@SuppressWarnings("unchecked")
    //public T findById(String id) {
    //    String strSQL = "SELECT * FROM sys_account WHERE id_=?";
    //    return (T)this.em.createNativeQuery(strSQL, this.entityClass)
    //                  .setParameter(1, id)
    //                  .getSingleResult();
    //}
}